
Simulation of compositional data from Gaussian mixture models.
rmixcomp(n, prob, mu, sigma, type = "alr")
The sample size
A vector with mixing probabilities. Its length is equal to the number of clusters.
A matrix where each row corresponds to the mean vector of each cluster.
An array consisting of the covariance matrix of each cluster.
Should the additive ("type=alr") or the isometric (type="ilr") log-ration be used? The default value is for the additive log-ratio transformation.
A list including:
A numeric variable indicating the cluster of simulated vector.
A matrix containing the simulated compositional data. The number of dimensions will be + 1.
A sample from a multivariate Gaussian mixture model is generated.
Ryan P. Browne, Aisha ElSherbiny and Paul D. McNicholas (2015). R package mixture: Mixture Models for Clustering and Classification.
# NOT RUN {
p <- c(1/3, 1/3, 1/3)
mu <- matrix(nrow = 3, ncol = 4)
s <- array( dim = c(4, 4, 3) )
x <- as.matrix(iris[, 1:4])
ina <- as.numeric(iris[, 5])
mu <- rowsum(x, ina) / 50
s[, , 1] <- cov(x[ina == 1, ])
s[, , 2] <- cov(x[ina == 2, ])
s[, , 3] <- cov(x[ina == 3, ])
y <- rmixcomp(100, p, mu, s, type = "alr")
# }
Run the code above in your browser using DataLab